As we discussed in the previous article, Blockchain Prerequisites- Cryptography Concepts, blockchain technology is just a clever combination of cryptography and computer networking. This time we’ll be covering the computer networking concepts that one must be aware of before starting their journey down the blockchain rabbit hole.
Computer networking is the study of the technology and architecture which links computer systems hence enabling communication and resource sharing among these systems. A group of these communicating computer systems is called a computer network.
Now let’s get started with concepts that you should be aware of:
1. Client-Server Network
Client-Server Network is an architecture of distributed applications in which most or all of the services and resources consumed by a client are maintained and rendered by a centralised server or a centralised group/cluster of servers. The client is much less powerful than the server in terms of computing power, storage and even authority. Most of the websites of the modern internet use client-server architecture.
The point for you to remember here is that client-server network is a centralised architecture, meaning that all the servers are owned and operated by a single entity or group of entities. Now, these “entities” could be private companies, consortiums or government agencies. Another result of the centralised architecture is that there could be little or no transparency on the server’s side, i.e. there is no technical mechanism for you to check what a website is doing with your data.
2. Peer-to-peer Network
In Peer-to-peer Networks work is assigned equally to all nodes and all nodes are considered to have the same authority. That is, there is no centralised server to serve the requests, any node can act as a server and serve a request. Here nodes act as server and client both, even simultaneously.
The point for you to remember is, these networks have a flat hierarchy with no single point of ownership, authority or control and hence no single point of failure. Accordingly, peer-to-peer networks are referred to as decentralised architectures.
Blockchain networks are public (generally) peer-to-peer networks, i.e. anyone can join them and as it is a peer-to-peer network no one owns or completely controls the network. This is the “decentralisation of control” which blockchains provide.
3. Blockchain Protocols
“Bitcoin network” implies the peer-to-peer network of nodes which run a Bitcoin client i.e. a computer software complying with the Bitcoin protocol. The Bitcoin protocol refers to the set of rules and functionalities the developers of Bitcoin have deemed essential for a Bitcoin client to have. These rules and functionalities ensure that the Bitcoin network works properly and the blockchain is maintained correctly. As a result, you can code a Bitcoin client in any language, it should just follow the Bitcoin protocol and connect to the Bitcoin network (don’t do this unless you know what you are doing, this is not an easy task). Other blockchains and peer-to-peer projects have a similar structure of open-source clients following the specified blockchain protocols like Ethereum and IPFS.
4. Sending Data and Bootstrapping in Peer-to-peer Networks
How exactly is data sent between the blockchain nodes?
All data transfers are governed through the Gossip Protocol. Gossip protocol is a mechanism of spreading information over a peer-to-peer network. It is similar to the spreading of a virus in an epidemic. A TCP connection is established between the nodes which require the IP address of the other node.
How does a new node connect to other nodes?
The answer is simple - on switching on for the first time, a Bitcoin node requests a list of IP addresses of peers from the first peer it finds and then requests it again from the peers it discovered through the first peer and so on. This process is called bootstrapping. This “first peer” which provided a list of IP addresses of its peers is called the bootstrapping node or bootstrap node.
How does a new node find this bootstrap node?
Well, Bitcoin clients use something called DNS seeds to discover peers in the network. A DNS seed is basically a DNS Server. A DNS server is used in client-server networks to convert domain names like “topcoder.com” into the actual IP address of the servers hosting the Topcoder website. In the case of Bitcoin, these DNS seeds maintain and return a list of the IP addresses of active Bitcoin nodes. Hence, they are queried by a newly-joined node to get the IP address of a node to bootstrap with.
Another option available in Bitcoin clients is manually providing the IP address of the bootstrap node on running the client for the first time. Ethereum takes it further by hardcoding the IP addresses of a couple of reliable nodes which act as bootstrap nodes.